package LockService;

import java.io.Serializable;
import java.util.Date;
import java.util.concurrent.locks.Lock;

public class LockMessage implements Serializable {
    private Integer clientId;
    private Date acquireTime;
    private Date lockTime;
    private Integer timeoutSeconds;
    private String lockedMethod;
    private Integer clientApplyId;
    private String status;

    @Override // 重写hashCode方法使LockMessage类可以作为Map的key
    public int hashCode() {
        return (clientId.toString() + clientApplyId.toString()).hashCode();
    }

    @Override // 重写equals方法，认为clientId和clientApplyId一致的申请就是同一个申请
    public boolean equals(Object object) {
        if(!(object instanceof LockMessage)){
            return false;
        }
        else {
            return this.clientId.equals(((LockMessage)object).clientId) && this.clientApplyId.equals(((LockMessage)object).clientApplyId);
        }
    }

    public Integer getClientId() {
        return clientId;
    }

    public void setClientId(Integer clientId) {
        this.clientId = clientId;
    }

    public Date getAcquireTime() {
        return acquireTime;
    }

    public void setAcquireTime(Date acquireTime) {
        this.acquireTime = acquireTime;
    }

    public Date getLockTime() {
        return lockTime;
    }

    public void setLockTime(Date lockTime) {
        this.lockTime = lockTime;
    }

    public Integer getTimeoutSeconds() {
        return timeoutSeconds;
    }

    public void setTimeoutSeconds(Integer timeoutSeconds) {
        this.timeoutSeconds = timeoutSeconds;
    }

    public String getLockedMethod() {
        return lockedMethod;
    }

    public void setLockedMethod(String lockedMethod) {
        this.lockedMethod = lockedMethod;
    }

    public Integer getClientApplyId() {
        return clientApplyId;
    }

    public void setClientApplyId(Integer clientApplyId) {
        this.clientApplyId = clientApplyId;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
